(C) 1996 AROS - The Amiga Replacement OS
// Use this function to compare to stringpointers int cmp_strptr (const char ** sptr1, const char ** sptr2) { return strcmp (*sptr1, *sptr2); } // Sort an array of strings char ** strings; // fill the array strings = malloc (sizeof (char *)*4); strings[0] = strdup ("h"); strings[1] = strdup ("a"); strings[2] = strdup ("f"); strings[3] = strdup ("d"); // Sort it qsort (strings, sizeof (char *), 4, (void *)cmp_strptr);